package com.hong610.net.http.client;

import com.hong610.net.enums.NetAgreement;
import com.hong610.net.enums.NetHandle;

/**
 * NetClient,用户可访问的层面
 * Created by Hong on 2016/12/31.
 */
public class NetClient extends NetHttp {

	/**
	 *
	 */
	public NetClient() { }

	/**
	 *
	 * @param url 路径
	 */
	public NetClient(String url) {
		this.setUrl(url);
	}

	/**
	 *
	 * @param url 网址
	 * @param charset 编码
	 */
	public NetClient(String url, String charset) {
		this.setUrl(url);
		this.setCharset(charset);
	}

	/**
	 *
	 * @param url 网址
	 * @param netAgreement 请求方式
	 */
	public NetClient(String url, NetAgreement netAgreement) {
		this.setUrl(url);
		this.setNetAgreement(netAgreement);
	}

	/**
	 *
	 * @param url 网址
	 * @param charset 编码
	 * @param netAgreement 请求方式
	 */
	public NetClient(String url, String charset, NetAgreement netAgreement) {
		this.setUrl(url);
		this.setCharset(charset);
		this.setNetAgreement(netAgreement);
	}
	
	public NetClient setUrl(String url){
		super.url = url;
		return this;
	}
	public NetClient setCharset(String charset){
		this.charset = charset;
		return this;
	}
	public NetClient setNetAgreement(NetAgreement netAgreement){
		super.netAgreement = netAgreement;
		return this;
	}
	/**
	 * 设置数据处理方式
	 * @param netHandle NORMAL, STREAM, DOWNLOAD, UPLOAD;
	 * @return NetClient
	 */
	public NetClient setNetHandle(NetHandle netHandle){
		this.handle = netHandle;
		return this;
	}

	/**
	 * 设置证书和密码
	 * @param cret 证书地址
	 * @param password 证书密码
	 */
	public void cret(String cret, String password){
		this.cret = cret;
		this.cret_password = password;
	}


}
